Next | Prev | Up | Top | Contents | Index

Signals

A signal is an urgent notification of an event, sent asynchronously to a process. Some signals originate from the kernel: for example, the SIGFPE signal that notifies of an arithmetic overflow; or SIGALRM that notifies of the expiration of a timer interval (for the complete list, see the signal(5) reference page). The Frame Scheduler issues signals to notify your program of errors or termination. Other signals can originate within your own program.

In order to receive a signal, a process must establish a signal handler, a function that will be entered when the signal arrives.

There are three UNIX traditions for signals, and IRIX supports all three. They differ in the library calls used, in the range of signals allowed, and in the details of signal delivery (see Table 3-1). Your real-time program should use the POSIX interface for signals.

Signal Handling Interfaces
FunctionSVR4-compatible CallsBSD 4.2 CallsPOSIX Calls
set and query signal handlersigset(2)
signal(2)
sigvec(3)
signal(3)
sigaction(2)
sigsetops(3)
sigaltstack(2)
send a signalsigsend(2)
kill(2)
kill(3)
killpg(3)
sigqueue(2)
temporarily block specified signalssighold(2)
sigrelse(2)
sigblock(3)
sigsetmask(3)
sigprocmask(2)
query pending signals  sigpending(2)
wait for a signalsigpause(2)sigpause(3)sigsuspend(2)
sigwait(2)
sigwaitinfo(2)
sigtimedwait(2)

The POSIX interface supports the following 64 signal types:

1-31

Same as BSD

32

Reserved by IRIX kernel

33-48

Reserved by the POSIX standard for system use

49-64

Reserved by POSIX for real-time programming
Signals with smaller numbers have priority for delivery. The low-numbered BSD-compatible signals, which include all kernel-produced signals, are delivered ahead of real-time signals; and signal 49 takes precedence over signal 64. (The BSD-compatible interface supports only signals 1-31. This set includes two user-defined signals.)

IRIX 5.3 supports POSIX signal handling as specified in document 1003.1b-1993. This includes FIFO queueing new signals when a signal type is held, up to a system maximum of queued signals. (The maximum can be adjusted using systune; see the systune(1) reference page.)

For more information on the POSIX interface to signal handling, refer to Topics in IRIX Programming and to the signal(5), sigaction(2), and sigqueue(2) reference pages. Some POSIX signal-handling functions are used in sample code in "Interprocess Communication" in Appendix A.


Signal Latency

The time that elapses from the moment a signal is generated until your signal handler begins to execute is the signal latency. Signal latency can be long (as real-time programs measure time) and signal latency has a high variability. (Some of the factors are discussed under "Signal Delivery and Latency".) In general, you should use signals to deliver infrequent messages of high priority. You should not use the exchange of signals as the basis for scheduling in a real-time program.

Note: Signals are delivered at particular times when using the Frame Scheduler. See "Using Signals Under the Frame Scheduler".


Next | Prev | Up | Top | Contents | Index